package com.atguigu.bigdata.scala.chapter02

import java.io.OutputStream
import java.net.Socket

object Scala08_Net_Master {

    def main(args: Array[String]): Unit = {

        // TODO 主机
        // 连接从机，发送数据
        val serverSocket : Socket = new Socket("localhost", 9999)
        println("连接从机成功，准备发送数据...");

        // 获取输出流
        val out: OutputStream = serverSocket.getOutputStream
        // 输出数据
        out.write(300)
        out.flush()
        out.close()
        println("数据发送成功...");
        serverSocket.close()
    }
}
